home *** CD-ROM | disk | FTP | other *** search
- Path: news.tamu.edu!news
- From: Clint Chapman <bubbac@tamu.edu>
- Newsgroups: comp.lang.c++
- Subject: Re: Converting integer to char/string?
- Date: 5 Feb 1996 23:12:11 GMT
- Organization: Texas A&M University, College Station, TX
- Message-ID: <4f62sb$gc4@news.tamu.edu>
- References: <4f5sj8$5f8@news1.usa.pipeline.com>
- NNTP-Posting-Host: jdw.tamu.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (X11; I; AIX 2)
- X-URL: news:4f5sj8$5f8@news1.usa.pipeline.com
-
- The header is "stdlib.h" and the function is
-
- char *itoa(int num, const char *, int radix);
-
- This program displays the value of 1423 in hexadecimal (58F)
-
- #include <stdlib.h>
- #include <stdio.h>
-
- void main(void)
- {
- char p[20];
- itoa(1423,p,16);
- printf(p);
- }
- ..
-
- This was taken from "C The Complete Reference" 2nd ed. by H. Schildt, 1990.
-
- Hope this helped. BTW, at the time this book was published, its kinda old, it
- was not part of the ANSI standard, but is found in most compiliers.
-
- Clint Chapman
- --
- ___________________________________________________________________
- Clinton Chapman - Graduate Assistant Researcher
- Texas A&M University - Department of Aerospace Engineering
- Email: bubbac@tamu.edu - (409)845-0745 , (409)862-4265
- FAX: (409)845-6051
- Homepage: http://www.isc.tamu.edu/~clint
- ___________________________________________________________________
-
-